/*
   POSPrinter.cpp
   
   Copyright (C) 2006 LinuxOne, Inc. <Republic of korea>

   This library is free software; you can redistribute it and/or modify
   it under the terms of the GNU Lesser General Public License as
   published by the Free Software Foundation; either version 2.1
   of the License, or (at your option) any later version.

   This library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of 
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
   Lessor General Public License for more details.

   You should have received a copy of the GNU Lessor General Public
   LinuxOne, Inc., hereby disclaims all copylight
   written by Hyunjin Kim, 28 December 2006
	   License along with this library; if not, write to the Free Software
	   Foundation, inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

	   Hyunjin Kim <mgc521@linuxone.co.kr>

*/

#include <services/POSPrinterService.h>
#include <assert.h>
#include <iconv.h>

namespace booyopos
{

namespace services
{

CPOSPrinterService::CPOSPrinterService()
{
	deviceServiceDescription = "BooyoPOS POSPrinter Device Service";
	deviceServiceVersion = 0;
	physicalDeviceDescription = "EPSON POS Printer";
	physicalDeviceName = "TM-T88IV";
}

CPOSPrinterService::~CPOSPrinterService()
{
}

/* Capabilities */
int
CPOSPrinterService::GetCapCharacterSet()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return capCharacterSet;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

bool
CPOSPrinterService::GetCapConcurrentJrnRec()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return capConcurrentJrnRec;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

bool
CPOSPrinterService::GetCapConcurrentJrnSlp()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return capConcurrentJrnSlp;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

bool
CPOSPrinterService::GetCapConcurrentRecSlp()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return capConcurrentRecSlp;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

bool
CPOSPrinterService::GetCapCoverSensor()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return capCoverSensor;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

bool
CPOSPrinterService::GetCapJrn2Color()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return capJrn2Color;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

bool
CPOSPrinterService::GetCapJrnBold()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return capJrnBold;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

bool
CPOSPrinterService::GetCapJrnDhigh()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return capJrnDhigh;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

bool
CPOSPrinterService::GetCapJrnDwide()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return capJrnDwide;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

bool
CPOSPrinterService::GetCapJrnDwideDhigh()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return capJrnDwideDhigh;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

bool
CPOSPrinterService::GetCapJrnEmptySensor()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return capJrnEmptySensor;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

bool
CPOSPrinterService::GetCapJrnItalic()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return capJrnItalic;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

bool
CPOSPrinterService::GetCapJrnNearEndSensor()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return capJrnNearEndSensor;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

bool
CPOSPrinterService::GetCapJrnPresent()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return capJrnPresent;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

bool
CPOSPrinterService::GetCapJrnUnderline()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return capJrnUnderline;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

bool
CPOSPrinterService::GetCapRec2Color()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return capRec2Color;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

bool
CPOSPrinterService::GetCapRecBarCode()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return capRecBarCode;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

bool
CPOSPrinterService::GetCapRecBitmap()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return capRecBitmap;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

bool
CPOSPrinterService::GetCapRecBold()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return capRecBold;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

bool
CPOSPrinterService::GetCapRecDhigh()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return capRecDhigh;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

bool
CPOSPrinterService::GetCapRecDwide()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return capRecDwide;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

bool 
CPOSPrinterService::GetCapRecDwideDhigh()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return capRecDwideDhigh;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

bool
CPOSPrinterService::GetCapRecEmptySensor()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return capRecEmptySensor;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

bool
CPOSPrinterService::GetCapRecItalic()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return capRecItalic;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

bool
CPOSPrinterService::GetCapRecLeft90()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return capRecLeft90;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

bool
CPOSPrinterService::GetCapRecNearEndSensor()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return capRecNearEndSensor;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

bool
CPOSPrinterService::GetCapRecPapercut()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return capRecPapercut;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

bool
CPOSPrinterService::GetCapRecPresent()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return capRecPresent;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

bool
CPOSPrinterService::GetCapRecRight90()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return capRecRight90;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

bool
CPOSPrinterService::GetCapRecRotate180()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return capRecRotate180;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

bool
CPOSPrinterService::GetCapRecStamp()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return capRecStamp;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

bool
CPOSPrinterService::GetCapRecUnderline()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return capRecUnderline;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

bool
CPOSPrinterService::GetCapSlp2Color()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return capSlp2Color;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

bool
CPOSPrinterService::GetCapSlpBarCode()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return capSlpBarCode;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

bool
CPOSPrinterService::GetCapSlpBitmap()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return capSlpBitmap;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

bool
CPOSPrinterService::GetCapSlpBold()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return capSlpBold;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

bool
CPOSPrinterService::GetCapSlpDhigh()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return capSlpDhigh;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

bool
CPOSPrinterService::GetCapSlpDwide()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return capSlpDwide;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

bool
CPOSPrinterService::GetCapSlpDwideDhigh()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return capSlpDwideDhigh;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

bool
CPOSPrinterService::GetCapSlpEmptySensor()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return capSlpEmptySensor;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

bool
CPOSPrinterService::GetCapSlpFullslip()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return capSlpFullslip;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

bool
CPOSPrinterService::GetCapSlpItalic()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return capSlpItalic;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

bool
CPOSPrinterService::GetCapSlpLeft90()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return capSlpLeft90;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

bool
CPOSPrinterService::GetCapSlpNearEndSensor()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return capSlpNearEndSensor;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

bool
CPOSPrinterService::GetCapSlpPresent()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return capSlpPresent;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

bool
CPOSPrinterService::GetCapSlpRight90()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return capSlpRight90;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

bool
CPOSPrinterService::GetCapSlpRotate180()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return capSlpRotate180;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

bool
CPOSPrinterService::GetCapSlpUnderline()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return capSlpUnderline;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

bool
CPOSPrinterService::GetCapTransaction()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return capTransaction;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

int
CPOSPrinterService::GetCapPowerReporting()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return capPowerReporting;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

int
CPOSPrinterService::GetCapJrnCartridgeSensor()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return capJrnCartridgeSensor;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

int
CPOSPrinterService::GetCapJrnColor()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return capJrnColor;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

int
CPOSPrinterService::GetCapRecCartridgeSensor()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return capRecCartridgeSensor;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

int
CPOSPrinterService::GetCapRecColor()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return capRecColor;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

int
CPOSPrinterService::GetCapRecMarkFeed()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return capRecMarkFeed;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

bool
CPOSPrinterService::GetCapSlpBothSidesPrint()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return capSlpBothSidesPrint;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

int
CPOSPrinterService::GetCapSlpCartridgeSensor()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return capSlpCartridgeSensor;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

int
CPOSPrinterService::GetCapSlpColor()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return capSlpColor;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

bool
CPOSPrinterService::GetCapMapCharacterSet()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return capMapCharacterSet;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

bool
CPOSPrinterService::GetCapStatisticsReporting()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return capStatisticsReporting;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

bool
CPOSPrinterService::GetCapUpdateStatistics()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return capUpdateStatistics;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

bool
CPOSPrinterService::GetCapCompareFirmwareVersion()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return capCompareFirmwareVersion;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

bool
CPOSPrinterService::GetCapConcurrentPageMode()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return capConcurrentPageMode;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

bool
CPOSPrinterService::GetCapRecPageMode()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return capRecPageMode;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

bool
CPOSPrinterService::GetCapSlpPageMode()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return capSlpPageMode;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

bool
CPOSPrinterService::GetCapUpdateFirmware()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return capUpdateFirmware;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

/* Properties */
bool
CPOSPrinterService::GetAsyncMode()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return asyncMode;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

void
CPOSPrinterService::SetAsyncMode(bool asyncMode)
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		CPOSPrinterService::asyncMode = asyncMode;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

int
CPOSPrinterService::GetCharacterSet()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return characterSet;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

void
CPOSPrinterService::SetCharacterSet(int characterSet)
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		CPOSPrinterService::characterSet = characterSet;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

std::string
CPOSPrinterService::GetCharacterSetList()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return characterSetList;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

bool
CPOSPrinterService::GetCoverOpen()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return coverOpen;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

int
CPOSPrinterService::GetErrorLevel()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return errorLevel;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

int
CPOSPrinterService::GetErrorStation()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return errorStation;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

std::string
CPOSPrinterService::GetErrorString()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return errorString;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

bool
CPOSPrinterService::GetFlagWhenIdle()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return flagWhenIdle;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

void
CPOSPrinterService::SetFlagWhenIdle(bool flagWhenIdle)
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		CPOSPrinterService::flagWhenIdle = flagWhenIdle;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

std::string
CPOSPrinterService::GetFontTypefaceList()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return fontTypefaceList;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

bool
CPOSPrinterService::GetJrnEmpty()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return jrnEmpty;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

bool
CPOSPrinterService::GetJrnLetterQuality()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return jrnLetterQuality;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

void
CPOSPrinterService::SetJrnLetterQuality(bool jrnLetterQuality)
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		CPOSPrinterService::jrnLetterQuality = jrnLetterQuality;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

int
CPOSPrinterService::GetJrnLineChars()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return jrnLineChars;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

void
CPOSPrinterService::SetJrnLineChars(int jrnLineChars)
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		CPOSPrinterService::jrnLineChars = jrnLineChars;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

std::string
CPOSPrinterService::GetJrnLineCharsList()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return jrnLineCharsList;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

int
CPOSPrinterService::GetJrnLineHeight()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return jrnLineHeight;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

void
CPOSPrinterService::SetJrnLineHeight(int jrnLineHeight)
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		CPOSPrinterService::jrnLineHeight = jrnLineHeight;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

int
CPOSPrinterService::GetJrnLineSpacing()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return jrnLineSpacing;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

void
CPOSPrinterService::SetJrnLineSpacing(int jrnLineSpacing)
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		CPOSPrinterService::jrnLineSpacing = jrnLineSpacing;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

int
CPOSPrinterService::GetJrnLineWidth()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return jrnLineWidth;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

bool
CPOSPrinterService::GetJrnNearEnd()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return jrnNearEnd;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

int 
CPOSPrinterService::GetMapMode()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return mapMode;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

void
CPOSPrinterService::SetMapMode(int mapMode)
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		CPOSPrinterService::mapMode = mapMode;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

int
CPOSPrinterService::GetOutputID()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return outputID;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

std::string
CPOSPrinterService::GetRecBarCodeRotationList()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return recBarCodeRotationList;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

bool
CPOSPrinterService::GetRecEmpty()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return recEmpty;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

bool
CPOSPrinterService::GetRecLetterQuality()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return recLetterQuality;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

void
CPOSPrinterService::SetRecLetterQuality(bool recLetterQuality)
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		CPOSPrinterService::recLetterQuality = recLetterQuality;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

int
CPOSPrinterService::GetRecLineChars()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return recLineChars;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

void
CPOSPrinterService::SetRecLineChars(int recLineChars)
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		CPOSPrinterService::recLineChars = recLineChars;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

std::string
CPOSPrinterService::GetRecLineCharsList()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return recLineCharsList;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

int
CPOSPrinterService::GetRecLineHeight()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return recLineHeight;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

void
CPOSPrinterService::SetRecLineHeight(int recLineHeight)
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		CPOSPrinterService::recLineHeight = recLineHeight;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

int
CPOSPrinterService::GetRecLineSpacing()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return recLineSpacing;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

void
CPOSPrinterService::SetRecLineSpacing(int recLineSpacing)
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		CPOSPrinterService::recLineSpacing = recLineSpacing;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

int
CPOSPrinterService::GetRecLinesToPaperCut()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return recLinesToPaperCut;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

int
CPOSPrinterService::GetRecLineWidth()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return recLineWidth;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

bool
CPOSPrinterService::GetRecNearEnd()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return recNearEnd;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

int
CPOSPrinterService::GetRecSidewaysMaxChars()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return recSidewaysMaxChars;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

int
CPOSPrinterService::GetRecSidewaysMaxLines()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return recSidewaysMaxLines;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

int
CPOSPrinterService::GetRotateSpecial()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return rotateSpecial;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

void
CPOSPrinterService::SetRotateSpecial(int rotateSpecial)
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		CPOSPrinterService::rotateSpecial = rotateSpecial;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

std::string
CPOSPrinterService::GetSlpBarCodeRotationList()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return slpBarCodeRotationList;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

bool
CPOSPrinterService::GetSlpEmpty()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return slpEmpty;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

bool
CPOSPrinterService::GetSlpLetterQuality()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return slpLetterQuality;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

void
CPOSPrinterService::SetSlpLetterQuality(bool recLetterQuality)
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		CPOSPrinterService::slpLetterQuality = slpLetterQuality;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

int
CPOSPrinterService::GetSlpLineChars()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return slpLineChars;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

void
CPOSPrinterService::SetSlpLineChars(int recLineChars)
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		CPOSPrinterService::slpLineChars = slpLineChars;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

std::string
CPOSPrinterService::GetSlpLineCharsList()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return slpLineCharsList;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

int
CPOSPrinterService::GetSlpLineHeight()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return slpLineHeight;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

void
CPOSPrinterService::SetSlpLineHeight(int recLineHeight)
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		CPOSPrinterService::slpLineHeight = slpLineHeight;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

int
CPOSPrinterService::GetSlpLinesNearEndToEnd()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return slpLinesNearEndToEnd;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

int
CPOSPrinterService::GetSlpLineSpacing()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return slpLineSpacing;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

void
CPOSPrinterService::SetSlpLineSpacing(int slpLineSpacing)
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		CPOSPrinterService::slpLineSpacing = slpLineSpacing;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

int
CPOSPrinterService::GetSlpLineWidth()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return slpLineWidth;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

int
CPOSPrinterService::GetSlpMaxLines()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return slpMaxLines;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

bool
CPOSPrinterService::GetSlpNearEnd()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return slpNearEnd;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

int
CPOSPrinterService::GetSlpSidewaysMaxChars()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return slpSidewaysMaxChars;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

int
CPOSPrinterService::GetSlpSidewaysMaxLines()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return slpSidewaysMaxLines;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

int
CPOSPrinterService::GetPowerNotify()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return powerNotify;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

void
CPOSPrinterService::SetPowerNotify(int powerNotify)
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		CPOSPrinterService::powerNotify = powerNotify;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

int
CPOSPrinterService::GetPowerState()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return powerState;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

int
CPOSPrinterService::GetCartridgeNotify()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return cartridgeNotify;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

void
CPOSPrinterService::SetCartridgeNotify(int cartridgeNotify)
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		CPOSPrinterService::cartridgeNotify = cartridgeNotify;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

int
CPOSPrinterService::GetJrnCartridgeState()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return jrnCartridgeState;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

int
CPOSPrinterService::GetJrnCurrentCartridge()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return jrnCurrentCartridge;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

void
CPOSPrinterService::SetJrnCurrentCartridge(int jrnCurrentCartridge)
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		CPOSPrinterService::jrnCurrentCartridge = jrnCurrentCartridge;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

int
CPOSPrinterService::GetRecCartridgeState()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return recCartridgeState;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

int
CPOSPrinterService::GetRecCurrentCartridge()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return recCurrentCartridge;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

void
CPOSPrinterService::SetRecCurrentCartridge(int recCurrentCartridge)
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		CPOSPrinterService::recCurrentCartridge = recCurrentCartridge;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

int
CPOSPrinterService::GetSlpCartridgeState()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return slpCartridgeState;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

int
CPOSPrinterService::GetSlpCurrentCartridge()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return slpCurrentCartridge;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

void
CPOSPrinterService::SetSlpCurrentCartridge(int cartridge)
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		CPOSPrinterService::slpCurrentCartridge = slpCurrentCartridge;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

int
CPOSPrinterService::GetSlpPrintSide()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return slpPrintSide;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

bool
CPOSPrinterService::GetMapCharacterSet()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return mapCharacterSet;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

void
CPOSPrinterService::SetMapCharacterSet(bool mapCharacterSet)
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		CPOSPrinterService::mapCharacterSet = mapCharacterSet;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

std::string
CPOSPrinterService::GetRecBitmapRotationList()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return recBitmapRotationList;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

std::string
CPOSPrinterService::GetSlpBitmapRotationList()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return slpBitmapRotationList;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

std::string
CPOSPrinterService::GetPageModeArea()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return pageModeArea;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

int
CPOSPrinterService::GetPageModeDescriptor()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return pageModeDescriptor;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

int
CPOSPrinterService::GetPageModeHorizontalPosition()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return pageModeHorizontalPosition;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

void
CPOSPrinterService::SetPageModeHorizontalPosition(int pageModeHorizontalPosition)
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		CPOSPrinterService::pageModeHorizontalPosition = pageModeHorizontalPosition;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

std::string
CPOSPrinterService::GetPageModePrintArea()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return pageModePrintArea;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

void
CPOSPrinterService::SetPageModePrintArea(std::string pageModePrintArea)
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		CPOSPrinterService::pageModePrintArea = pageModePrintArea;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

int
CPOSPrinterService::GetPageModePrintDirection()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return pageModePrintDirection;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

void
CPOSPrinterService::SetPageModePrintDirection(int pageModePrintDirection)
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		CPOSPrinterService::pageModePrintDirection = pageModePrintDirection;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

int
CPOSPrinterService::GetPageModeStation()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return pageModeStation;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

void
CPOSPrinterService::SetPageModeStation(int pageModeStation)
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		CPOSPrinterService::pageModeStation = pageModeStation;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

int
CPOSPrinterService::GetPageModeVerticalPosition()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		return pageModeVerticalPosition;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

void
CPOSPrinterService::SetPageModeVerticalPosition(int pageModeVerticalPosition)
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		CPOSPrinterService::pageModeVerticalPosition = pageModeVerticalPosition;
	}
	catch(CByException bye)
	{
		throw bye;
	}
}


/* Methods */
/* Methods New added*/
void
CPOSPrinterService::Initialize()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		char buf[2]={};

		//** Initialize Printer **//
		//ESC @
		buf[0] = 0x1B;
		buf[1] = 0x40;

		write(fd, buf, 2);

	}
	catch(CByException bye)
	{
		throw bye;
	}
}

void
CPOSPrinterService::FontReverse(bool onoff)
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		/* TO DO */

		char buf[5]={};

		buf[0] = 0x1D;
		buf[1] = 0x42;

		if( onoff )
		{
			buf[2] = 1;	///* white / black reverse mode is turned on
			std::cout << "FontReverse is turned on" << std::endl;
			std::cout << buf[2] << std::endl;
			//buf[2] = 0x01;	///* white / black reverse mode is turned on
		}
		else
		{
			buf[2] = 0 & buf[2];	///* white / black reverse mode is turned off
			std::cout << "FontReverse is turned off" << std::endl;
			std::cout << buf[2] << std::endl;
			//buf[2] = 0x00;	///* white / black reverse mode is turned off
		}

		write(fd, buf, strlen(buf));
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

void
CPOSPrinterService::FontSelect(bool font, bool emphasize, bool doubleHeight, bool doubleWidth, bool underline)
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		/* TO DO */

		char buf[5]={};

		buf[0] = 27;		//buf[0] = 0x1B;
		buf[1] = 33;		//buf[1] = 0x21;
		buf[2] = 0;

		if( font )
			buf[2] += 1;	///< Character font B selected 
		if( emphasize )
			buf[2] += 8;	///< Emphasized mode selected
		if( doubleHeight )
			buf[2] += 16;	///< Double-height mode selected
		if( doubleWidth )
			buf[2] += 32;	///< Double-width mode selected
		if( underline )
			buf[2] += 128;	///< Underline mode selected

		write(fd, buf, strlen(buf));
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

void
CPOSPrinterService::FontAlign(int alignment)
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		/* TO DO */

		char buf[5]={};

		buf[0] = 27;	// 0x1B
		buf[1] = 97;	// 0x61

		if( alignment == 1 )
		{
			buf[2] = 1;	///< Align Center
			std::cout << "FontAlign is Center" << std::endl;
		}
		else if( alignment == 2 )
		{
			buf[2] = 2;	///< Align Right
			std::cout << "FontAlign is Right" << std::endl;
		}
		else
		{
			buf[2] = 0;	///< Align Left
			std::cout << "FontAlign is Left" << std::endl;
		}

		write(fd, buf, strlen(buf));
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

void
CPOSPrinterService::NLineFeed(unsigned int repeat)
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}
		char buf[3]={};

		buf[0] = 0x1B;
		buf[1] = 0x64;

		buf[2] = repeat;

		std::cout << "NLineFeed is executed" << std::endl;

		write(fd, buf, 3); 
	}
	catch(CByException bye)
	{
		throw bye;
	}
}


/* Methods Original */
void
CPOSPrinterService::BeginInsertion(int timeout)
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		char buf[5]={};
		/* TO DO */



	}
	catch(CByException bye)
	{
		throw bye;
	}
}

void
CPOSPrinterService::BeginRemoval(int timeout)
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		char buf[5]={};
		/* TO DO */

	}
	catch(CByException bye)
	{
		throw bye;
	}
}

void
CPOSPrinterService::ClearOutput()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		char buf[5]={};
		/* TO DO */

	}
	catch(CByException bye)
	{
		throw bye;
	}
}

void
CPOSPrinterService::CutPaper(int percentage)
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}
		
		char buf[5]={};
		// percentage = 100;	// Full cut
		// percentage =  90;	// Leave only a small portion

		buf[0] = 0x1D;
		buf[1] = 0x56;
		buf[2] = 0x31;	// 49

	    	std::cout << "full cut" << std::endl;
		std::cout << percentage << std::endl;

		if( percentage == 100 )
		{
		    buf[2] = 0x30;  ///< A full cut
		    std::cout << "full cut" << std::endl;
		    std::cout << percentage << std::endl;
		}
		else if( percentage < 100 && percentage >= 50)                             
		{
		    buf[2] = 0x31;  ///< A partial cut                                     
		    std::cout << "partial cut" << std::endl;
		    std::cout << percentage << std::endl;
		}
		else
		{
		    buf[2] = 0x31;                                                
		    std::cout << "partial cut" << std::endl;
		    std::cout << percentage << std::endl;
		}

		write(fd, buf, strlen(buf));

	}
	catch(CByException bye)
	{
		throw bye;
	}
}

void
CPOSPrinterService::EndInsertion()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		char buf[5]={};
		/* TO DO */

	}
	catch(CByException bye)
	{
		throw bye;
	}
}

void
CPOSPrinterService::EndRemoval()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		char buf[5]={};
		/* TO DO */

	}
	catch(CByException bye)
	{
		throw bye;
	}
}

void
CPOSPrinterService::PrintBarCode(int station, std::string data, int symbology, int height, int width, int alignment, int
		textPosition)
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		char buf[5]={};
		/* TO DO */

	}
	catch(CByException bye)
	{
		throw bye;
	}
}

void
CPOSPrinterService::PrintBitmap(int station, std::string fileName, int width, int alignment)
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		char buf[5]={};
		/* TO DO */

	}
	catch(CByException bye)
	{
		throw bye;
	}
}

void
CPOSPrinterService::PrintImmediate(int station, std::string data)
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		char buf[5]={};
		/* TO DO */

	}
	catch(CByException bye)
	{
		throw bye;
	}
}

void
CPOSPrinterService::PrintNormal(int station, int encoding, std::string data)
throw (CByException)
{
	try
	{
		char buf[5]={};

		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		if( station == PTR_S_JOURNAL )
		{
		}
		else if( station == PTR_S_RECEIPT )
		{
		}
		else if( station == PTR_S_SLIP )
		{
		}
		else
		{
		}

		/* iconv module block */

		if(encoding)
		{
			char indata[255]={};
			char outdata[255]={};

			size_t inbytesleft;
			size_t outbyteleft;

			sprintf(indata, "%s", data.c_str());
			
			char *inbuf_p = indata;
			char *outbuf_p = outdata;

			iconv_t cd = iconv_open("EUC-KR", "UTF8");

			if (cd < 0)
			 perror("iconv");

			inbytesleft = strlen(indata);
			assert(inbytesleft != 0);

			outbyteleft = 999;
			iconv(cd, &inbuf_p, &inbytesleft, &outbuf_p, &outbyteleft);

			iconv_close(cd);

			write(fd, outdata, strlen(outdata));
		}
		else
		{
			write(fd, data.c_str(), data.size());
		}

		/* End iconv module block */


	}
	catch(CByException bye)
	{
		throw bye;
	}
}

void
CPOSPrinterService::PrintTwoNormal(int stations, std::string data1, std::string data2)
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		char buf[5]={};
		/* TO DO */

	}
	catch(CByException bye)
	{
		throw bye;
	}
}

void
CPOSPrinterService::RotatePrint(int Station, int rotation)
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		char buf[5]={};
		/* TO DO */

	}
	catch(CByException bye)
	{
		throw bye;
	}
}

void
CPOSPrinterService::SetBitmap(int bitmapNumber, int station, std::string fileName, int width, int alignment)
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		char buf[5]={};
		/* TO DO */

	}
	catch(CByException bye)
	{
		throw bye;
	}
}

void
CPOSPrinterService::SetLogo(int location, std::string data)
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		char buf[5]={};
		/* TO DO */

	}
	catch(CByException bye)
	{
		throw bye;
	}
}

void
CPOSPrinterService::TransactionPrint(int station, int control)
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		char buf[5]={};
		/* TO DO */

	}
	catch(CByException bye)
	{
		throw bye;
	}
}

void
CPOSPrinterService::ValidateData(int Station, std::string data)
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		char buf[5]={};
		/* TO DO */

	}
	catch(CByException bye)
	{
		throw bye;
	}
}

void
CPOSPrinterService::ChangePrintSide(int side)
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		char buf[5]={};
		/* TO DO */

	}
	catch(CByException bye)
	{
		throw bye;
	}
}

void
CPOSPrinterService::MarkFeed(int type)
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		char buf[5]={};
		/* TO DO */

	}
	catch(CByException bye)
	{
		throw bye;
	}
}

void
CPOSPrinterService::ClearPrintArea()
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		char buf[5]={};
		/* TO DO */

	}
	catch(CByException bye)
	{
		throw bye;
	}
}

void
CPOSPrinterService::PageModePrint(int control)
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		char buf[5]={};
		/* TO DO */

	}
	catch(CByException bye)
	{
		throw bye;
	}
}

void
CPOSPrinterService::PrintMemoryBitmap(int station, char* data, int type, int width, int alignment)
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		char buf[5]={};
		/* TO DO */

	}
	catch(CByException bye)
	{
		throw bye;
	}
}

/* Statistics */
void
CPOSPrinterService::ResetStatistics(std::string statisticsBuffer)
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		/* TO DO */
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

void
CPOSPrinterService::RetrieveStatistics(std::string statisticsBuffer[])
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		/* TO DO */
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

void
CPOSPrinterService::UpdateStatistics(std::string statisticsBuffer)
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		/* TO DO */
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

void
CPOSPrinterService::CompareFirmwareVersion(std::string firmwareFileName, int* result)
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		/* TO DO */
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

void
CPOSPrinterService::UpdateFirmware(std::string firmwareFileName)
throw (CByException)
{
	try
	{
		if(!bOpen)
		{
			throw new CByException(E_CLOSED, "Device is not opened");
		}

		/* TO DO */
	}
	catch(CByException bye)
	{
		throw bye;
	}
}

} // namespace services

} // namespace booyopos
